package com.interview.javabasic.JUC;

import java.util.concurrent.TimeUnit;

public class CallAndSend {
    public static void main(String[] args) {
          phone phone = new phone();
          phone phone1 = new phone();
        new Thread(()->{ phone1.send(); },"Simon").start();

        new Thread(()->{phone.send();},"Lily").start();



    }
}
//业务类只有属性和方法
class phone{


    public static synchronized void call() throws InterruptedException {
        TimeUnit.SECONDS.sleep(5);
        System.out.println(Thread.currentThread().getName() + "在打电话...");
    }
    public static synchronized void send(){
        System.out.println(Thread.currentThread().getName() + "在发信息...");
    }


}
